@echo off

echo ```bash > KiCad_CN_index.md

tree /f >> KiCad_CN_index.md

echo ``` >> KiCad_CN_index.md

rem 根据指定的行号范围删除多个txt文件里的连续多行内容
set #=Any question&set @=WX&set/az=0x152c&set $$=cel
title %#% +%$%%$%/%@% %z%
cd /d "%~dp0"
set lines=2-4
REM set "newfolder=newfolder"
REM chcp 65001
REM if not exist "%newfolder%" md "%newfolder%"
for /f "delims=" %%a in ('dir /a-d/b KiCad_CN_index.md') do (
    echo;"%%a"
    (for /f "tokens=1,2 delims=-" %%b in ("%lines%") do (
        for /f "tokens=1* delims=:" %%e in ('findstr /n .* "%%a"') do (
            if %%e lss %%b echo;%%f
            if %%e gtr %%c echo;%%f
        )
    ))>"tmp.md"
	REM "%newfolder%\%%a"
)
echo;%#% +%@% %$$%%z%

move tmp.md KiCad_CN_index.md